Identification of cow-level risk factors and associations of selected blood macro-minerals at parturition with dystocia and stillbirth in Holstein dairy cows

A deeper understanding of the risk factors for dystocia and stillbirth could help farmers make decisions about dairy cow management. The objectives of this study were to investigate cow-level risk factors associated with dystocia and stillbirth in a relatively large sample of dairy cows using multivariable linear regression models. The data consisted of 51,405 calving records of 14,546 Holstein cows from 3 dairy herds in Isfahan Province, Iran, collected between April 2011 and September 2017. To investigate the association between selected blood macro-minerals and the incidence of dystocia and stillbirth, blood samples were collected at the time of parturition from a random subset of these cows, which included 1311 animals. The incidence of dystocia and stillbirths averaged 14.7% and 4.3%, respectively. Results showed that calving year, calving season, dry period length, BCS, parity, calf sex, calf birth weight, twin status, and stillbirth were significantly associated with the incidence of dystocia. According to the Random Forest (RF) classifier, we found that dry period length, calf birth weight, and parity were the most important cow-level risk factors for the incidence of dystocia. Calving year, calving season, parity, twin status, dry period length, calf birth weight, calf sex, and dystocia were significantly associated with the incidence of stillbirths. The most important risk factors identified by the RF classifier for stillbirths were twin status, parity, dry period length, and calf birth weight. Also, interactions between the cow-level risk factors associated with dystocia and stillbirth were identified. The incidence of dystocia was associated with the interactions of twin status × calf birth weight and twin status × stillbirth. According to our analysis, the incidence of stillbirth is caused by interactions among several factors, such as twin status × length of dry period, twin status × calving season, and twin status × parity. The highest incidence of dystocia (21.3%) and stillbirths (5.4%) was observed in hypo-calcemic cows. In conclusion, twin status seems to be a determining factor for the incidence of stillbirths but not for dystocia. Finally, the results of this study may help the dairy industry make management decisions aimed at reducing dystocia and stillbirth rates.


Results
This study focused on large industrial dairy herds in Isfahan Province, Iran. A summary of the data is provided in Table 1. To ensure the integrity of the data and to avoid inconsistencies among the herds studied, traits were categorized based on their most common definitions, as shown in Table 2. Figure 1 shows a causal web illustrating the main effects and interactions among cow-level factors associated with the incidence of dystocia and stillbirths using the results of multivariable logistic regression models.

Cow-level risk factors of dystocia. Calving number and percentage of stillbirths for variables included in
the binary logistic regression model of the generalized linear mixed model for cow-level risk factors for dystocia incidence are shown in Table 3. Estimated odds ratios (OR) and 95% confidence levels (CI) of the risk factors are shown in Supplemental Table S1A-B. A mean dystocia incidence of 14.7% was determined. Dystocia incidence varied across calving years (P < 0.01). The lowest (13.7%) and highest (17.2%) dystocia incidence was recorded in calving years 2016 (OR = 1.00) and 2015 (OR = 1.34), respectively. The incidence of dystocia varied by season (within 10% significance threshold, P = 0.08), with the lowest and highest incidence of 14.3% and 15.9% recorded in summer (OR = 0.99) and winter (OR = 1.08), respectively. The incidence of dystocia was higher in Scientific Reports | (2022) 12:5929 | https://doi.org/10.1038/s41598-022-09928-w www.nature.com/scientificreports/ cows of parity 1 (15.5%; referent) and > 4 (15.1%; OR = 0.86) than in the other parities (P < 0.01). An association was found between dry period length and dystocia incidence (P < 0.01). Cows with dry period lengths between 45 and 60 days (OR = 0.47) had the lowest incidence (10.8%). Dystocia incidence increased with increasing dry period length. Additionally, gestational length affected the incidence of dystocia (P < 0.01). The incidence of dystocia was higher for male (OR = 1.36) than female (referent) calves (17.6%: male vs. 11.7%: female; P < 0.01). The incidence of dystocia was higher for overconditioned cows (body condition score, BCS > 3.75; OR = 1.27) than other cows (P < 0.01). Also, interaction effects of twin status × calf birth weight and twin status × stillbirth were significantly associated with dystocia incidence (Fig. 2, P < 0.01). When cows give birth to twins, calves weighing more than 44 kg at birth are more likely to have dystocia ( Fig. 2A). The incidence of dystocia in cows that gave birth to stillborn calves was higher in twins than in singletons (Fig. 2B).
Selected blood macro-minerals. Calving number and percentage of stillbirths for selected blood macrominerals at parturition included in the binary logistic regression model of the generalized linear mixed model for dystocia incidence are shown in Table 4. Estimated OR and 95% CI of selected blood macro-minerals at the time of parturition that were associated with the incidence of dystocia are shown in Supplemental Table S2. Blood concentrations of Ca (P = 0.02) and P (within 10% significance threshold, P = 0.09) at the time of parturition that were associated with the incidence of dystocia. The highest incidence of dystocia was observed in cows with hypocalcemia (≤ 8 mg/dL) and hypophosphatemia (≤ 4 mg/dL) at the time of parturition. Blood concentrations of magnesium (Mg) at the time of parturition were not significantly associated with the incidence of dystocia.

Cow-level risk factors of stillbirth. Calving number and percentage of stillbirths for variables included
in the binary logistic regression model of the generalized linear mixed model for cow-level risk factors for stillbirth incidence are shown in Table 5. Estimated OR and 95% CI of the risk factors for stillbirth incidence are shown in Supplemental Table S3A-D. A mean stillbirth incidence of 4.3% was determined. Stillbirth incidence varied across calving years (P < 0.01). The lowest (3.2%) and highest (5.3%) incidence of stillbirths was recorded in calving years 2016 (OR = 0.37) and 2012 (OR = 1.02), respectively. Additionally, gestational length affected the incidence of stillbirths (P < 0.01). The incidence of stillbirths was higher (P = 0.02) for males (OR = 1.16) than for female (referent) calves (4.1%: male calves vs. 4.5%: female calves. The incidence of stillbirths was higher with dystocia (P < 0.01; OR = 2.04) compared with non-assisted births (9.3% vs. 3.4%, respectively). www.nature.com/scientificreports/ Interaction effects of parity × twin status, dry period length × twin status, and calving time × twin status and calving time × calf birth weight were significantly associated with the incidence of stillbirths (P < 0.01; Fig. 3). In cows that gave birth to twins, the risk of stillbirth was greater for cows with parity > 4 than for other parities (Fig. 3A). Cows with a dry period > 100 days had a higher risk of stillbirth in cows that gave birth to twins (Fig. 3B). Cows calving in summer had a higher rate of stillbirth than in other seasons in cows giving birth to twins (Fig. 3C). In addition, calving in summer may increase the risk of stillbirth when calves are born with low birth weight (≤ 35 kg) (Fig. 3D).
Selected blood macro-minerals. Calving number and percentage of stillbirths for selected blood macrominerals at parturition included in the binary logistic regression model of the generalized linear mixed model for stillbirth incidence are shown in Table 6. Estimated OR and 95% CI of selected blood macro-minerals at the time of parturition that were associated the incidence of stillbirths are shown in Supplemental Table S4. Blood concentrations of Ca at the time of parturition that were associated with the incidence of stillbirths (P = 0.01). The highest incidence of stillbirths was observed in cows with hypocalcemia (≤ 8 mg/dL) at the time of parturition. Blood concentrations of P and Mg at parturition were not significantly associated with the incidence of stillbirths.
Random forest. Figure 4 shows the cow-level risk factors identified by RF for dystocia (Fig. 4A) and stillbirth (Fig. 4B), ranked by mean decrease accuracy. Figure 4C and D illustrate the ROC (receiver operating characteristic) curves for dystocia and stillbirth, respectively. The area under the ROC curve (AUC) was 0.65 (95% CI 0.53-0.76) and 0.78 (95% CI 0.57-0.94) for dystocia and stillbirth, respectively. Based on RF classification mod- www.nature.com/scientificreports/ els, there were sensitivity and specificity values of 64% and 53% (for dystocia) and 75% and 66% (for stillbirth), respectively. The highest-ranking factors for dystocia were dry period length, calf birth weight, and parity. The highest-ranking factors for stillbirth were twin status, parity, dry period length, and calf birth weight.

Discussion
Cow-level risk factors associated with dystocia and stillbirth. A total of 51,405 calving records of 14,546 cows from 3 dairy herds in Isfahan Province (Iran) were evaluated for potential cow-level risk factors associated with dystocia and stillbirths. The incidences of dystocia and stillbirth averaged 14.7% and 4.3%, respectively. The results of the final multivariable logistic regression models were used in this study to test for the main effects and interaction effects of cow-level risk factors associated with the incidence of dystocia and stillbirth in a relatively large sample of dairy cows. The results showed that calving year, calving season, dry period length, BCS, parity, calf sex, calf birth weight, twin status, and stillbirth were significantly associated with dystocia incidence. In addition to logistic regression analysis, we used feature importance in RF classifier for identifying the most important cow-level risk factors that contribute most strongly to the incidence of dystocia and stillbirth. Feature importance in the RF classifier is an effective method to reduce the number of input variables to the most important ones and to maintain the interpretability of the final model 43 . Using RF, we found that dry period length, calf birth weight, and parity were the most important cow-level risk factors for the incidence of dystocia. Calving year, calving season, parity, twin status, dry period length, calf birth weight, calf sex, and dystocia were significantly associated with stillbirth incidence. The most important risk factors identified by the RF for stillbirths were twin status, parity, dry period length, and birth weight of the calf.  www.nature.com/scientificreports/ As reported in this study, the incidence of dystocia was lowest in summer and highest in winter, at 14.3% and 15.9%, respectively. When comparing winter and summer calvings, dystocia was more likely to occur during the winter and less likely during the summer, perhaps because in colder winters, blood flow to the uterus increases, leading to a heavier calf [44][45][46] . Despite this, we found no interaction between calving season, calf birth weight, and dystocia incidence in the present study. Our results are consistent with those obtained previously by Gaafar et al., 47 who found that dystocia was most prevalent in winter and least prevalent in summer in dairy Friesian cows. In regards to the factors mentioned above, dry period length has been associated with the risk of dystocia. Table 5. Calving number and percentage of stillbirths for variables included in the binary logistic regression model of the generalized linear mixed model for cow-level risk factors for stillbirth incidence in Holstein dairy cows (n = 51,405). www.nature.com/scientificreports/ We found that a longer dry period was associated with a higher incidence of dystocia, and cows with a long dry period of more than 100 days had the highest incidence, whereas cows with a shorter dry period between 46 and 60 days had the lowest incidence. Similar results were reported by Atashi et al. 2 which reported a more frequent incidence of dystocia in cows with a dry period > 60 days compared to cows with a shorter dry period. In addition, Enevoldsen and Sørensen 48 , found that dystocia was more likely in cows with long dry period (10 weeks) lengths than in cows with a dry period of 4 to 7 weeks. Consistent with this, Barkema et al., 49 reported that cows with a long dry period were more likely to have an increased risk of cesarean section. Cows with long dry periods gain excessive body fat during the extended dry period as the cows do not regulate their feed intake according to their physiological needs 50 . Cows which experience dystocia are more likely to have a higher body condition (more body fat) as a result of their prolonged dry periods. Roche et al. 51 reported an increased risk of metabolic disorders associated with an excess body condition at calving. Besides over-conditioning, the long dry period may result in altered Ca metabolism 52 .
The higher incidence of dystocia in primiparous cows (parity 1) as compared to multiparous cows (parities 2 and 3) observed in the current study, agrees with previous studies 53, 54 . The higher risk of dystocia in primiparous than multiparous cows may be due to feto-pelvic disproportion and abnormal fetal position, and uterine inertia in   55 and may be influenced by the birth weight of the calf. In this study, male calves were more likely to cause dystocia than female calves, with is in line with previous reports 1, 56 . We observed that male calves with a birth weight over 42.7 ± 6 kg (mean ± SD) were larger than female calves with less than 39.5 ± 5 kg (mean ± SD). In this study, a higher risk of dystocia was observed in cows that gave birth to male calves than in cows that gave birth to female calves. A part of this could be due to the fact that male calves are heavier 1,56 and have larger dimensions 57 than female calves, or it could also be due to other factors.  www.nature.com/scientificreports/ There is evidence that male calves are at risk for several reproductive disorders, including dystocia 1 and stillbirths 15 , which have been associated with increased risk of mortality in dairy cows 15,58 . The percentage of male and female calves in this study was 50.5% and 49.5%, respectively, and male calves were more likely to be stillborn, which is consistent with the results of Maltecca et al. 59 that male calves have a higher risk of stillbirth than female calves. According to a recent study, the stillbirth rate for male calves (7.7%) was more than twice as high as that of female calves (3.7%) 60 . Mellado et al. 61 found that calves with a birth weight of < 35 kg had the highest probability of stillbirth, which is in line with our findings.
Gestation length, the period from conception to calving, has a significant impact on the breeding and performance of cattle 62 . Stillbirths are associated with both longer and shorter gestation periods 63 . According to Nogalsk and Piwczyński 62 , the optimal gestation length was found in the range of 275-277 days based on the incidence of dystocia and stillbirth. In a study of more than 4000 Friesian cows, Johanson and Berger 45 found that 282 days was the optimal gestation length that minimizes the risk of stillbirth. Deviation from an optimal value for gestation length has resulted in increased stillbirth rates 62 . The average gestation length was 274 ± 5 days for cows with twin birth and 277 ± 5 days for cows with single births in the current study. Previous studies reported that cows calving twins were more likely to have stillbirths than cow calving singletons, probably due to shorter gestational periods and higher incidences of dystocia 64,65 . Early-born calves are more likely to die of oxygen deprivation (birth asphyxia) within 2 days, which may contribute to the higher stillbirth rate among twins. Therefore, cows that suffer dystocia when they calve twins are at increased risk for stillbirths.
Interactions. The interactions among multiple risk factors that determine the incidence of dystocia and stillbirth were evaluated and illustrated (Fig. 1). According to our results, the incidence of dystocia was associated with the interactions of twin status × calf birth weight and twin status × stillbirths. In the current study, calving calves that weigh more than 44 kg at birth may increase the risk of dystocia if the cows give birth to twins compared with singletons. This interaction can be explained by the fact that twins with higher birth weight (> 44 kg) have a more negative effect on feto-pelvic disproportion than single births. Dystocia is strongly associated with the ratio between the pelvic area of the dam and the birth weight of the calf 55,66 . Fetopelvic disproportion is caused by an incompatibility between the size of the fetus and the size of the maternal pelvis, which may result from one or a combination of factors 67 . Therefore, a heavy twin calf may have a harder time going through a smaller pelvic area than a light twin calf. There are other factors, such as over-expansion of the uterus due to the weight of the twins and their placenta, and impaired metabolism due to less space for the rumen in the abdomen, that could also affect the ease of calving in cows with twin fetuses compared to cows with single births.
The incidence of dystocia was associated with the interaction between twin status × stillbirths. The current study found that the incidence of dystocia in cows giving birth to stillborn calves increased in twins compared to singletons. There is a positive correlation between twin birth and stillbirths 68 . This interaction can be explained by the fact that cows with twins are more likely to have inadequate abdominal contractions and to deliver calves in an abnormal position, presentation, and posture 69 , which results in a higher risk of stillbirth. The interaction between twin status and dry period length was significantly associated with the incidence of stillbirths in the current study. According to the current study, the risk of dystocia was greater in cows with a dry period > 100 days when cows calving twins than those calving singletons. This interaction can be explained by the fact that a longer dry period means that cows may be exposed to anabolic influences for a longer period, increasing the likelihood of over-conditioning at calving 70 , higher calf birth weight, and stillbirth risk in twin calves. The interaction between twin status and parity was significantly associated with the incidence of stillbirths in the current study. In dairy cows, twinning increases with increasing parity, ranging from 1% at first parity to nearly 10% at later parities 27 . In this study, there was a greater incidence for twin calves to be stillborn when their dam at their fourth or greater parities (≥ 4). This interaction can be explained by the fact that the occurrence of twins in dairy cows increases with age (~ 4 to 30% with primiparous and multiparous cows), which is due to the increased occurrence of multiple ovulations 71,72 . One explanation is that due to a higher embryonic mortality rate in twin pregnancies 73 , a twin pregnancy in older cows has a lower probability of survival and is more likely to result in embryonic loss or stillbirth than in younger cows 71 . This could be because one embryo prevents the other from settling in the uterus, depriving it of nutrients and converting the pregnancy from twins to singletons, as has been documented in mares 74 .
The interaction between twin status and calving season was significantly associated with the incidence of stillbirths in the current study. Under conditions of heat stress, dams and their offspring show altered physiological responses, tissue development, metabolism, and immunity 75 . In utero hyperthermia negatively affects fetal growth and postnatal physiology of offspring, such as immune function and metabolic adaptation [76][77][78] . Cows that suffered from severe heat stress prenatally and at birth (THI > 83 units) were 1.3 more likely to stillbirth than cows with lower heat stress 61 . In the current study, a higher rate of stillbirths was observed in cows calving twins in summer than in other seasons. This can be explained by the fact that dams exposed to heat stress in late gestation delivered calves with lower birth weights, indicating impaired fetal development 75,79,80 . Therefore, heat stress in late gestation leads to intrauterine growth restriction and can decrease placental weight 81,82 , which may explain part of the lower birth weight due to in utero hyperthermia in summer than in winter in stillborn calves in cows that gave birth to twins.

Associations of blood macro-minerals at parturition with dystocia and stillbirth.
We also compared dystocia and stillbirth in cows with macro-minerals deficiency and normal cows at the time of parturition. Normal blood Ca level in dairy cows is between 2.1 and 2.5 mmol/L (8.5 and 10 mg/dL) 83 . Based on available data, the highest incidence of dystocia (21.3%) and stillbirths (5.4%) was observed in the group of cows with plasma Ca concentrations less than 8 mg/dL at the time of parturition, which is considered hypocalcemia. These  85 . The reduction in plasma Ca levels reduces Ca stores in smooth muscle, especially in the sarcoplasmic network of skeletal muscle. Thus, the absence of uterine contractions or uterine fatigue, as well as abdominal muscle contractions, may prolong the parturition process in cattle and lead to dystocia 86 and stillbirth.

Study limitations and possible applications.
This study had the limitation of not being able to account for fetal presentations/abnormalities or distinguish between calves that died within 24 h and calves that were stillborn. The study was also limited by the fact that only one blood sample was collected at calving. Further studies with multiple blood samples around calving and to discover new biomarkers associated with dystocia and stillbirth would be helpful. Several attempts have been made to reduce the incidence of dystocia. For example, selection for low calf birth weight relative to expected sire progeny differences could contribute to the smaller skeletal size and lower calf birth weight, especially in heifers 44 . Also, selection for a larger pelvic area (pelvic height and width) as well as measuring internal pelvic dimensions and culling heifers with abnormally shaped or very small pelvic areas before breeding could help reduce the incidence of dystocia during the first parturition 87,88 . It is possible to reduce twinning as a risk factor of stillbirths in high-yielding dairy cows with a two-track approach. Double ovulation and dizygotic twins can be reduced by manipulating ovarian function to increase progesterone during growth of the preovulatory follicle before timed artificial insemination [89][90][91] . Second, cows diagnosed with bilateral twins early in gestation should be allowed to continue gestation with additional support at calving, whereas selective reduction may be attempted in cows diagnosed with unilateral twins 91 . Intensive monitoring of parturition is necessary to reduce the incidence of dystocia and stillbirth [92][93][94] . Several technologies are available to monitor the onset of calving [94][95][96][97] . These include inclinometers and accelerometers that detect tail raising and behavioural changes, intravaginal thermometers that detect allantochorion expulsion and body temperature drop, abdominal belts that monitor uterine contractions, and devices that monitor calf expulsion in the vaginal or vulvar lips 94,98,99 . To reduce the incidence of stillbirths, dairy cows can be monitored more frequently with a surveillance camera system before calving 100 . Evidence suggests that farmer obstetric skills and calving management training are associated with a reduction in stillbirth rates 101,102 . A previous study on an Irish dairy farm concluded that lack of monitoring of the second stage of parturition (expulsion of the calf) resulted in a higher incidence of dystocia in cattle 103 . This was recently confirmed by a Hungarian study in which monitoring the onset of calving with a calving alarm thermometer reduced the incidence of dystocia and improved postpartum health of the dam and newborn calf survival 95 .

Conclusions
Based on our results, the most important risk factors identified by RF for dystocia were length of dry period, calf birth weight, and parity. Cows with a long dry period of more than 100 days were associated with the highest incidence of dystocia, while cows with a short dry period between 46 and 60 days had the lowest incidence. Our results showed that the incidence of dystocia in cows that delivered stillborn calves was higher in twins than in singletons. This study found that cows giving birth to twins have an increased risk of dystocia if the calves weigh more than 44 kg, suggesting that twin calves with a higher birth weight have a greater impact on feto-pelvic disproportion than singletons. The major risk factors identified by RF for stillbirths were twin status, parity, length of dry period, and calf birth weight. However, at the cow level, several risk factors interact to cause stillbirths in dairy cows. In cows that gave birth to twins, the risk of stillbirth was greater in cows with parity > 4 than in other parities. One finding of this study was that cows with a dry period > 100 days had a higher risk of stillbirth in cows that gave birth to twins. Compared to other seasons, a higher rate of stillbirths was observed in cows calving twins in summer. Finally, calving in summer may increase the risk of stillbirth if calves are born at low birth weight (≤ 35 kg). As indicated by the data, cows that were hypo-calcemic at the time of parturition had a higher risk of dystocia and stillbirth. www.nature.com/scientificreports/ Performance and pedigree were officially recorded on all three dairy farms. During the dry-period, all cows were housed in sand-bedded freestall barns. All cows were moved to prepartum pens 21 ± 5 days before the expected calving date and were closely monitored by trained personnel and/or veterinarians on the farm. Cows were checked every 3-5 h for signs of imminent parturition (i.e., udder enlargement, milk let-down, relaxation of the tail ligament). After calving, all cows were moved to fresh housing pens with sand-bedded freestall barns where they remained for approximately 30 ± 4 days. Subsequently, cows were relocated to mid-lactation pens and fed regular lactation feed for ad libitum intake according to the farm's standard procedure. Cows were milked three times a day at 0800, 1600, and 0000 h (± 1 h) in a milking parlour equipped with mechanical ventilation (fan and spray system). Cows were fed a balanced total mixed ration (TMR) consisting of approximately 40% forage (corn silage, alfalfa hay, and straw) and 60% concentrate (i.e., barley grain, corn grain, beet pulp, soybean meal, canola meal, cottonseed meal, meat meal, protected fat powder, and vitamin supplements, sodium bicarbonate, macro-minerals, microminerals, salt, and feed additives). Although each herd had its feeding and management policy, all three dairy farms had regular veterinary care, artificial insemination, heat synchronization, and vaccination. All dairy cows were artificially inseminated, usually with semen from North American and European sires. Holstein cows from these dairy farms were subjected to the Ovsynch protocol by consulting veterinarians.

Materials and methods
All cows were milked at the first scheduled milking time (within 2 to 6 h) after calving. Calves from dairy herds were housed individually in straw-bedded pens indoor in temperature-controlled buildings and received 5-6 l of colostrum during the first 12 h of life (2.5-3 L by 1 h after birth and 2.5-3 L at 12 h after the first feeding). In the case of twin birth, the birth weights of both calves were considered separately. Data on Freemartin heifers were excluded from the analysis. Calves were then housed outdoors in individual pens with free access to water, hay, and starter feed until weaning when they were moved to group housing. Routine veterinary care of milk-fed calves was provided by herd veterinarians.
The study was conducted in two phases. Phase 1 examined cow-level risk factors influencing dystocia and stillbirth, while phase 2 examined the likely associations between selected blood macro-minerals and dystocia and stillbirth. All data were collected throughout the study by veterinarians on each farm using the same farm management software system. Cows were identified by their unique ID number. The original data set was edited to ensure reliability and consistency for statistical analysis. Therefore, records with missing or ambiguous calving dates, incorrect evaluation dates (for drying off, breeding, parturition), missing parity number, BW outside 15 to 70 kg, gestation length of less than 260 or more than 300 days, and an outlier in selected blood macro-minerals were excluded from the analysis. For the identification of outliers in selected blood macro-minerals, box plots of each raw data set were checked, and Z-standardization was performed. Outliers were identified as values with a standard deviation > 2. Phase 1 data consisted of 51,405 calving records from 14,546 Holstein cows collected between April 2011 and September 2017. In Phase 2, blood samples were collected from a random subset of those cows comprising 1311 animals along with other management information between April and September 2017. Randomization was performed at cow level by a computer-generated random number list when visiting each farm at least once a week on the same day for blood collection from all calving cows.
Blood sampling and analysis. To investigate the association between selected macro-minerals in blood at the time of parturition (1 h before to 1 h after calving) and the incidence of dystocia and stillbirth, blood samples from 1311 cows were collected via the coccygeal vessels in evacuated tubes containing an anticoagulant (EDTA) at the time of parturition from April to September 2017. Samples were then centrifuged at 1300×g for 15 min and then stored at − 20 °C until analysis. Plasma concentrations of Ca, phosphorus (P), and Mg were measured with an autoanalyzer (Alcyon 300, Abbott Laboratories, Abbott Park, IL, USA) using a diagnostic kit (Pars Azmoon Co., Tehran, Iran) according to the manufacturer's instructions.
Statistical analysis. Screening the dataset was conducted using the SQL Server software 104 running on Microsoft Windows 10 (Pro × 64) operating system. Statistical analyses were conducted using SAS statistical software v.9.4 (SAS Institute, Inc. Cary, North Carolina; http:// www. sas. com). Multivariable logistical regression procedures (PROC LOGISTIC) with backward elimination method through the maximum likelihood method of PROC GLIMMIX in SAS was performed to evaluate factors associated with the incidence of dystocia and stillbirth. At first, full data analysis including the main factors and all two-way interaction between variables was done. Interaction terms that did not significantly contribute to the regression model for dystocia and stillbirth were removed from the model one by one. Different models were compared using the Akaike information criteria (AIC) to evaluate the goodness-of-fit of the models. Also, multicollinearity among variables was evaluated in the model by computing the variance inflation factor (VIF). The homogeneity of variances (homoscedasticity) was verified by the specification of the COVTEST homogeneity command in SAS. An optimal model was selected based on the minimum AIC and the significance of the main effect or interaction associated with dystocia and stillbirth. The final models were as follows: Dystocia Stillbirth Logit(π) = α + Cyear i +Cseason j +Parity k +Drylen l +BCS m +TWN n +Sex o +Cweight p +SB q +β 1r (Preg ils )+β 2s (AFC ijk ) + Herd t + SB k × TWN n + TWN n × Cweight q Scientific Reports | (2022) 12:5929 | https://doi.org/10.1038/s41598-022-09928-w www.nature.com/scientificreports/ where π = the odds probability of dystocia or stillbirth; α = intercept parameter; Cyear = fixed effect of calving year; Cseason = fixed effect of calving season; Parity = fixed effect of parity effect (l = 1, 2, 3, ≥ 4); Drylen = fixed effect of dry period length; BCS = fixed effect of body condition (BCS = 1, 2 and 3); TWN = fixed effect of twin status (1 = single birth, 2 = twin birth); Sex = fixed effect of calf sex (1 = male and 2 = female); Cweigth = fixed effect of calf weight at parturition (Cweigth = 1, 2, 3, …, 6); SB = fixed effect of calving status (0 = normal calving, 1 = stillbirth) dys = fixed effect of calving type (0 = easy calving, 1 = dystocia); β 1 = regression coefficient of observations on gestation length (Preg) and age at first calving (AFC) as covariates and Herd = random effect. The association between dystocia and stillbirth incidence and each potential risk factor was investigated by odds ratio (OR) and its 95% CI. The incidence of dystocia or stillbirth was calculated by dividing the number of cases of dystocia or stillbirth per year by the total calving. The statistical models employed for the selected blood macro-minerals were as follows: where π = the odds probability of dystocia or stillbirth; α = the intercept parameter; Parity i = fixed effect of parity effect (l = 1, 2, 3, ≥ 4); Drylen j = fixed effect of dry period length; BCS k = the fixed effect of body condition (BCS = 1, 2 and 3); Sex l = fixed effect of calf sex (1 = male and 2 = female); Cweigth m = fixed effect of calf weight at parturition (Cweigth = 1, 2, 3, …, 6); CaL n : fixed effect of Ca concentrations levels (1, and 2); PL o : fixed effect of P concentrations levels (1, and 2); MgL p : fixed effect of Mg concentrations levels (1, and 2); β 1 = regression coefficient of observations on gestation length (Preg) as a covariate and Herd r = random effect. Statistical significance was considered when P ≤ 0.05; a trend was considered when 0.05 < P ≤ 0.10. Random forest was performed to rank cow-level risk factors based on their predictive value for dystocia and stillbirth from the machine learning module in JASP (Version 0.14) 105 . The dataset was split into three subsets: the training set (60%), the validation set (20%), and the test (20%). Classification performance is a report based on several metrics. For true positive (TP) as the number true positives, false positive (FP) as the number of false positives, true negative (TN) as the number of true negatives, and false negative (FN) as the number of false negatives, we measured the following: